﻿#region 命名空间

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;
using WinnerCMS.BLL;
using WinnerCMS.Common;
using WinnerCMS.Model;
using WinnerCMS.Model.Attribute;

#endregion

namespace WinnerCMS.WebUI.Admin.Common
{
    [Access("OP")]
    public partial class DiggManage : WebFactory.PageBase
    {
        /// <summary>
        ///     模型ID
        /// </summary>
        protected byte ModelId;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.ModelId = byte.Parse(Request["ModelId"]);

            if (!IsPostBack)
            {
                BindList(1);
            }
        }


        public void BindList(int pageNo)
        {
            this.GV_List.EmptyDataTemplate = GetTemplate(this);
            var pp = new PagingParam
            {
                PageNo = pageNo,
                PageSize = this.PageNavigation1.PageSize
            };

            this.GV_List.DataSource = new BLL.DiggManage().BindList(this.ModelId, pp);
            this.GV_List.DataBind();

            this.PageNavigation1.RecordCount = pp.RecordCount;
        }

        protected void PageNavigation1_PageChanging(object src, WebControls.PageChangingEventArgs e)
        {
            BindList(e.NewPageIndex);
        }

        protected void DelSeletedID_Click(object sender, EventArgs e)
        {
            PolicyInjection.Create<BLL.DiggManage>().Delete(GetSelectedRow.GetIDs(this.GV_List));

            BindList(1);
        }
    }
}